using UnityEngine;
using System.Collections;

public class TitleGUI : MonoBehaviour {
	
	public GUISkin skin;
	public int areaX = 70;
	public int areaY = 13;
	public bool high = false;
	
	
	// Use this for initialization
	void Start () {
	
	}
	
	// Update is called once per frame
	void Update () {
		
	
		}

void OnGUI()
	{
		GUI.skin = skin;
		GUI.BeginGroup(new Rect(areaX, areaY, 600, 600));
		GUI.Box(new Rect(0,0,400,400), "KABOOM!");
		//GUI.Label(new Rect(30,30,100,30), "A Label");
		//GUI.Button(new Rect(30,70,100,30), "Start");
		//GUI.Button(new Rect(275,90,100,30), "Exit");
		//GUI.Button(new Rect(155,140,100,30), "Difficulty");
		GUI.EndGroup();
		
		if (GUI.Button (new Rect (100,102,100,30), "Start/Easy"))
		{
			
			Application.LoadLevel(1);
			Time.timeScale = 1;
			
		}
		
		if(GUI.Button(new Rect (220,102,100,30), "Normal"))
		{
			Application.LoadLevel(2);
			Time.timeScale = 1;
		}
		
		if(GUI.Button(new Rect (340, 102,100,30), "Hard"))
		{
			Application.LoadLevel(3);
			Time.timeScale = 1;
		}
		
		if (GUI.Button (new Rect(220,175,100,30), "Exit"))
		{
			Application.Quit();
		}
		
		GUILayout.BeginArea(new Rect(220,240,100,300));
		
			if(GUILayout.Button("High Score"))//This is a high score button which switches a bool that allow the highscore menu to show
			{
				high = true;
			}
		     if (high)// when true this displays highscore data
			{
			//The scores are kept in the playerprefs area which is presitant data thats kept inb between plays
			int fstScore = PlayerPrefs.GetInt("0HScore");
		int sndScore = PlayerPrefs.GetInt("1HScore");
		int trdScore =PlayerPrefs.GetInt("2HScore");
			string fstName = PlayerPrefs.GetString("0HScoreName");
			string sndName = PlayerPrefs.GetString("1HScoreName");
			string trdName = PlayerPrefs.GetString("2HScoreName");
			
			GUILayout.Space(10);
			GUILayout.Label("Scores:");
			GUILayout.Space(5);
			
			GUILayout.Label("1st: - " +fstName + " - "+ fstScore.ToString());
			GUILayout.Label("2nd: - " +sndName + " - "+ sndScore.ToString());
			GUILayout.Label("3rd: - " +trdName + " - "+ trdScore.ToString());
			if(GUILayout.Button("Hide"))// a button to hide them
			{
			high = false;	
			}
		}
			GUILayout.EndArea();
			}
			}